package sdp.group14.management.tenant;

import sdp.group14.R;
import sdp.group14.management.MainActivity;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.View;

public class TenantManagementActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_tenent_entry);
    }

    
    public void onRequestListClick(View view) {
		try {
			
			Intent intent = new Intent(TenantManagementActivity.this,
					TenantRequestListActivity.class);
			startActivity(intent);

		} catch (Exception e) {
			Log.e("MAD", "error occurs when switch to  showing request activity");
		}
	}
    
    public void onAddRequestClick(View view) {
		try {
			
			Intent intent = new Intent(TenantManagementActivity.this,
					TenantAddRequestActivity.class);
			startActivity(intent);

		} catch (Exception e) {
			Log.e("MAD", "error occurs when switch to  adding request activity");
		}
	}
    
    @Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
	    if (keyCode == KeyEvent.KEYCODE_BACK) {
	    	try {			
				Intent intent = new Intent(TenantManagementActivity.this,
						MainActivity.class);				
				startActivity(intent);
				
			} catch (Exception e) {
				Log.e("tenantViewRequestAct", "error occurs in backing to tenant entry activity");
			}
	        return true;
	    }
	    return super.onKeyDown(keyCode, event);
	}
}
